home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / ka9q / kit_src / mk_bmrc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-03  |  3.1 KB  |  84 lines

  1. /*    (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
  2.  * 
  3.  *    Redistribution and use in source and binary forms are permitted for
  4.  *    non-commercial use, provided that the above copyright notice and this
  5.  *    paragraph are duplicated in all such forms.  THIS SOFTWARE IS PROVIDED
  6.  *    ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  7.  *    WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
  8.  *    FITNESS FOR A PARTICULAR PURPOSE.
  9.  */
  10. #include <stdio.h>
  11. #include <dir.h>
  12. #include "screen.h"
  13.  
  14. mk_bmrc()
  15. {
  16.     FILE *bmrc;
  17.     unsigned char buf[128], drive[MAXDRIVE], dir[MAXDIR], fname[MAXFILE];
  18.     unsigned char ext[MAXEXT], tmp[10];
  19.     int n;
  20.  
  21.     n = fnsplit(path, drive, dir, fname, ext);
  22.     if (n & DRIVE)
  23.         sprintf(buf, "%s\\bm.rc", drive);
  24.     else
  25.         sprintf(buf, "\\bm.rc");
  26.  
  27.     if (debug)
  28.     {
  29.         printf("***> BM.RC file (%s):\n", buf);
  30.         bmrc = stdout;
  31.     }
  32.     else
  33.     {
  34.         if ( (bmrc = fopen(buf, "r")) != NULL )
  35.         {
  36.             printf("\n(%s) already exists, overwrite (y/n)?  ",buf);
  37.             scanf("%s", tmp);
  38.             if ( (tmp[0] != 'y') && (tmp[0] != 'Y') )
  39.             {
  40.                 fclose(bmrc);
  41.                 return 0;
  42.             }
  43.         }
  44.         fclose(bmrc);
  45.         if ( (bmrc = fopen(buf, "w")) == NULL )
  46.         {
  47.             printf("\nCan't open \"%s\" for write, aborting!\n\n", buf);
  48.             exit(-1);
  49.         }
  50.     }
  51.  
  52.     fprintf(bmrc, "# configuration file for Bdale's Mailer... format is:\n");
  53.     fprintf(bmrc, "#        host <space> this_host_name\n");
  54.     fprintf(bmrc, "#        user <space> this_user_name\n");
  55.     fprintf(bmrc, "#        fullname <space> your full name for mail headers (optional)\n");
  56.     fprintf(bmrc, "#        reply <space> your reply address if not this machine (optional)\n");
  57.     fprintf(bmrc, "#                  useful for pc on large network off smart hosts\n");
  58.     fprintf(bmrc, "#        smtp <space> path to mailboxes          default /spool/mail\n");
  59.     fprintf(bmrc, "#        edit <space> path your editor (optional)\n");
  60.     fprintf(bmrc, "#        mbox <space> name of file used as default for s command (optional)\n");
  61.     fprintf(bmrc, "#        folder <space> name of directory for save mailby s command (optional)\n");
  62.     fprintf(bmrc, "#        mqueue <space> name of directory for outgoing messages\n");
  63.     fprintf(bmrc, "#        record <space> name of file save a copy of sent mail (optional)\n");
  64.     fprintf(bmrc, "#        maxlet <space> max number of message in mbox ( optional default 300)\n");
  65.     fprintf(bmrc, "#        screen direct | bios video mode ( turbo C only default direct )\n");
  66.     fprintf(bmrc, "#\n");
  67.     fprintf(bmrc, "host %s\n", callsign);
  68.     fprintf(bmrc, "user %s\n", callsign);
  69.     fprintf(bmrc, "fullname %s, %s, %s  [%ld.%ld.%ld.%ld]\n", name, city,
  70.             state, ((ip >> 24) & 0xff), ((ip >> 16) & 0xff),
  71.             ((ip >> 8) & 0xff), (ip & 0xff) );
  72.     fprintf(bmrc, "reply %s@%s\n", callsign, callsign);
  73.     fprintf(bmrc, "screen bios\n");
  74.     fprintf(bmrc, "edit %s\n", editor);
  75.     fprintf(bmrc, "smtp %s\\spool\\mail\n", path);
  76.     fprintf(bmrc, "mbox %s\\spool\\mbox\n", path);
  77.     fprintf(bmrc, "folder %s\\spool\n", path);
  78.     fprintf(bmrc, "mqueue %s\\spool\\mqueue\n", path);
  79.     fprintf(bmrc, "maxlet 400\n");
  80.  
  81.     if (!debug)
  82.         fclose(bmrc);
  83. }
  84.